#!/bin/bash
# Function to display help information

show_help() {
    echo "Usage: $0 [options]"
    echo
    echo "Options:"
    echo "  -h, --help    Show this help message and exit"

}

shutdown_all(){
	local_ip=$(hostname -I | awk '{print $1}')
	for ip in `python3 get_ansible_host_group_msg.py allnode`
	do
		if [ "$local_ip" != "$ip" ]; then
			ssh root@$ip " init 0 "
		fi
	done
}
# Process the arguments
while [[ $# -gt 0 ]]; do
    case $1 in
        -h|--help)
            show_help
            exit 0
            ;;
		-d|--shutdown)
			shutdown_all
			exit 0
			;;
        *)
            echo "Unknown option: $1"
            show_help
            exit 1
            ;;
    esac
    shift # Shift to the next argument
done
